import { IStoreUser } from "~/types";
type TAction={
  user:IStoreUser;
  commit:(type:string,payload:object)=>void;
}
export const state=function():IStoreUser{
  return {
    err:1,
    msg:'未登录',
    token:'',
    data:{}
  }
}

export const mutations = {
  M_UPDATE_USER(user:IStoreUser,payload:IStoreUser){
    user.err = payload.err;
    user.msg = payload.msg;
    user.data = payload.data;
    user.token = payload.token;
  }
}

export const actions = {
  A_UPDATE_USER({commit,user}:TAction,payload:{}){
    //..异步业务
    commit('M_UPDATE_USER',payload)
  }
}